package helpers.enums;

import java.io.Serializable;

public class Suggestion implements Serializable {

	private static final long serialVersionUID = 1L;

	private static final int PROBABLITIES_COUNT = 6;
	private static final String[] SUGGESTIONS = { "Pass",
			"Podbicie miedzy polowa puli a cala", "Przebicie powyzej puli",
			"Sprawdzenie", "Wejscie AllIn", "Czekanie" };
	private double[] propablities;

	public Suggestion(double[] probablities) {
		this.propablities = probablities;
	}

	public void setPropablities(double[] propablities) {
		this.propablities = propablities;
	}

	public double[] getPropablities() {
		return propablities;
	}

	@Override
	public String toString() {
		if (propablities.length != PROBABLITIES_COUNT) {
			return "Do not cheat. It is wrong";
		}

		StringBuilder builder = new StringBuilder(
				"-------------CHEAT MODE-------------\n");
		for (int i = 0; i < PROBABLITIES_COUNT; i++) {
			builder.append(round2(propablities[i]) * 100).append("%").append(
					"\t").append(SUGGESTIONS[i]).append("\n");
		}
		builder.append("-------------CHEAT MODE-------------\n");

		return builder.toString();
	}

	private static double round2(double d) {
		return Math.rint(100.0 * d) / 100.0;
	}
}
